/*
 * @(#)ErrorCode.java
 * Date 2013-04-11
 * Version 1.0
 * Author Jim Horner
 * Copyright (c)2012
 */


package us.hornerscorners.lamppost.registry.constant;

/**
 *
 * @author jim
 */
public enum ErrorCode {

    XDSDocumentUniqueIdError("XDSDocumentUniqueIdError"),
    XDSDuplicateUniqueIdInRegistry("XDSDuplicateUniqueIdInRegistry"),
    XDSExtraMetadataNotSaved("XDSExtraMetadataNotSaved"),
    XDSMetadataVersionError("XDSMetadataVersionError"),
    XDSMissingDocument("XDSMissingDocument"),
    XDSMissingDocumentMetadata("XDSMissingDocumentMetadata"),
    XDSMissingHomeCommunityId("XDSMissingHomeCommunityId"),
    XDSNonIdenticalHash("XDSNonIdenticalHash"),
    XDSPatientIDReconciliationError("XDSPatientIDReconciliationError"),
    XDSPatientIdDoesNotMatch("XDSPatientIdDoesNotMatch"),
    XDSReplaceFailed("XDSReplaceFailed"),
    XDSRegistryBusy("XDSRegistryBusy"),
    XDSRegistryDeprecatedDocumentError("XDSRegistryDeprecatedDocumentError"),
    XDSRegistryDuplicateUniqueIdInMessage("XDSRegistryDuplicateUniqueIdInMessage"),
    XDSRegistryError("XDSRegistryError"),
    XDSRegistryMetadataError("XDSRegistryMetadataError"),
    XDSRegistryNotAvailable("XDSRegistryNotAvailable"),
    XDSRegistryOutOfResources("XDSRegistryOutOfResources"),
    XDSRepositoryBusy("XDSRepositoryBusy"),
    XDSRepositoryDuplicateUniqueIdInMessage("XDSRepositoryDuplicateUniqueIdInMessage"),
    XDSRepositoryError("XDSRepositoryError"),
    XDSRepositoryMetadataError("XDSRepositoryMetadataError"),
    XDSRepositoryOutOfResources("XDSRepositoryOutOfResources"),
    XDSResultNotSinglePatient("XDSResultNotSinglePatient"),
    XDSSqlError("XDSSqlError"),
    XDSStoredQueryMissingParam("XDSStoredQueryMissingParam"),
    XDSStoredQueryParamNumber("XDSStoredQueryParamNumber"),
    XDSTooManyResults("XDSTooManyResults"),
    XDSUnavailableCommunity("XDSUnavailableCommunity"),
    XDSUnknownCommunity("XDSUnknownCommunity"),
    XDSUnknownPatientId("XDSUnknownPatientId"),
    XDSUnknownRepositoryId("XDSUnknownRepositoryId"),
    XDSUnknownStoredQuery("XDSUnknownStoredQuery"),
    XDSUnresolvedReferenceExceptionError("XDSUnresolvedReferenceException");

    /** Field description */
    private final String code;

    /**
     * Constructs ...
     *
     *
     * @param code
     */
    private ErrorCode(String uuid) {
        this.code = uuid;
    }

    /**
     * Method description
     *
     *
     * @param code
     *
     * @return
     */
    public static ErrorCode toErrorCode(String uuid) {

        ErrorCode result = null;

        for (ErrorCode myuuid : values()) {

            if (myuuid.code.equals(uuid)) {

                result = myuuid;

                break;
            }
        }

        return result;
    }

    /**
     * Method description
     *
     *
     * @return
     */
    public String getCode() {

        return this.code;
    }
}
